package com.qf.netty.handler;

import com.qf.entity.netty.HeartMsg;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;

/**
 * @Description:
 * @Author: xbb
 * @Date:2020/4/21
 */
public class HeartHandler extends SimpleChannelInboundHandler<HeartMsg> {
    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, HeartMsg heartMsg) throws Exception {
        System.out.println("处理心跳"+heartMsg);

        TextWebSocketFrame resp = new TextWebSocketFrame("heart");
        channelHandlerContext.writeAndFlush(resp);
    }
}
